﻿@{
    ViewBag.Title = "Create";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="dodobook">
    <input type="radio" value="1" id="111" name="dodo" style="display: none">
    <input type="radio" value="2" id="222" name="dodo" style="display: none">
    <input type="radio" value="3" id="333" name="dodo" style="display: none">
    <input type="radio" value="4" id="444" name="dodo" style="display: none">
    <button id="1" onclick="myRadio(this.id)" style="opacity: 0.5">正常</button>
    <button id="2" onclick="myRadio(this.id)" style="opacity: 0.5">不正常</button>
    <button id="3" onclick="myRadio(this.id)" style="opacity: 0.5">哈哈</button>
</div>

@section scripts {
    <script src="http://apps.bdimg.com/libs/jquery/1.10.1/jquery.min.js"></script>
    <script>
        function myRadio(sId) {
            $("button[id='" + sId + "']").css({ "border": "2px solid #FF6600", "opacity": "1" });
            $("button[id='" + sId + "']").siblings("button").css({ "border": "2px solid #008800", "opacity": "0.1" });
            $("input[name='dodo'][value='" + sId + "']").attr("checked", true);
            $("input[name='dodo'][value='" + sId + "']").siblings("input").prop("checked", false);
            //为点击按钮添加选中状态
            var chked = $('input[name=dodo]:checked').val();
            alert(chked);
        }
</script>
    }